#include <vector>
using namespace std;
class Solution
{
public:
    void helper(int i, vector<int> &temp, vector<vector<int>> &res, const vector<int> &nums)
    {
        if (i == nums.size())
        {
            res.push_back(temp);
            return;
        }
        // 不选
        helper(i + 1, temp, res, nums);
        // 选
        temp.push_back(nums[i]);
        // 加上后面的结果
        helper(i + 1, temp, res, nums);
        temp.pop_back();
    }
    vector<vector<int>> subsets(vector<int> &nums)
    {
        vector<vector<int>> res;
        vector<int> temp;
        helper(0, temp, res, nums);
        return res;
    }
};